/*
 * Copyright (C) 拾光分享网 
 * All rights reserved, Designed By www.hiai.top.
 * Email：goodsking@163.com.
 * Version：V1.0.2(20230701).
 */
package top.hiai.common.model;

import top.hiai.common.model.base.UserBase;

/**
 * @Author www.hiai.top
 * @Email goodsking@163.com
 * @Message 更多资源尽在www.hiai.top
 * @Introduction 类的介绍：用户实体类
 */

@SuppressWarnings("serial")
public class User extends UserBase<User> {

    /**
     * 刚注册时使用默认头像
     */
    public static final String AVATAR_NO_AVATAR = "default.png";
    /**
     * 锁定账号，无法做任何事情
     */
    public static final int STATUS_LOCK_ID = -1;
    /**
     * 注册、未激活
     */
    public static final int STATUS_REG = 0;
    /**
     * 用户状态正常
     */
    public static final int STATUS_OK = 1;


    /**
     * 未认证
     */
    public static final int IS_AUTH_NO = 0;
    /**
     * 用户已经认证
     */
    public static final int IS_AUTH_OK = 1;
    /**
     * 用户提交认证了,
     */
    public static final int IS_AUTH_FA = 2;


    /**
     * 是VIP
     */
    public static final int IS_USER_VIP_YES = 1;
    /**
     * 不是VIP,
     */
    public static final int IS_USER_VIP_No = 0;

    public boolean isStatusOk() {
        return getStatus() == STATUS_OK;
    }

    public boolean isStatusReg() {
        return getStatus() == STATUS_REG;
    }

    public boolean isAuthOk() {
        return getIs_auth() == IS_AUTH_OK;
    }

    public boolean isAuthNo() {
        return getIs_auth() == IS_AUTH_NO;
    }

    public boolean isAuthFa() {
        return getIs_auth() == IS_AUTH_FA;
    }

    public boolean isVipYes() {
        return getIs_auth() == IS_USER_VIP_YES;
    }
    public boolean isVipNo() {
        return getIs_auth() == IS_USER_VIP_No;
    }

    /**
     * 用户表中status说明
     * status = 0 注册、未激活
     * status = 1 用户正常使用
     * status = -1 锁定
     * status = 2  暂无
     *
     * @return
     */

    public boolean isStatusLockId() {
        return getStatus() == STATUS_LOCK_ID;
    }

    /**
     * 移除密码和salt
     *
     * @return
     */
    public User removeSensitiveInfo() {
        remove("password", "salt");
        return this;
    }
}